#include "StompedReality/Core/MessageSystem/MessageGroup.h"
#include <assert.h>
namespace StompedReality
{
namespace Core
{
MessageGroup::MessageGroup ( ) :
  StompedReality::Core::MessageHandler( ),
  StompedReality::GameAccess( )
{
  this->_groupID = 0;
}

MessageGroup::~MessageGroup( )
{
}

void MessageGroup::setGroupID ( StompedReality::ID id )
{
  this->_groupID = id;
}

StompedReality::ID MessageGroup::getGroupID( )
{
  return this->_groupID;
}

void MessageGroup::addItem ( TYPE_ID typeID, ID id )
{
  IDTypeIDTuple item;
  item.id = id;
  item.type = typeID;
  this->_groupItems.push_back ( item );
}

MsgGroupItems* MessageGroup::getItems( )
{
  return &( this->_groupItems );
}

IDTypeIDTuple MessageGroup::GetItemTupleAt( int idx )
{
  return this->_groupItems[idx];
}

IDTypeIDTuple MessageGroup::GetFirstTupleOf( StompedReality::TYPE_ID typeID )
{
  for (MsgGroupItems::iterator iter = this->_groupItems.begin( );
       iter != this->_groupItems.end( );
       ++iter)
  {
    if ((*iter).type == typeID)
      return *iter;
  }
  assert( false );
}

}
}
